#ifndef _KEY_H
	#define _KEY_H
	
#include "stm32f10x.h"
#include "tim.h"
#include "i2c.h"

extern u32 TimingDelay;
extern u16 set_fre;
extern float Vavg ;
extern float Vim ;
extern u16 time;
extern u16 milestone;
extern u16 total;

#define RB1 GPIO_ReadInputDataBit(GPIOA, GPIO_Pin_0)
#define RB2 GPIO_ReadInputDataBit(GPIOA, GPIO_Pin_8)
#define led GPIO_Pin_8

#define key1 1
#define key2 2

void key_init(void);
void led_init(void);
void delay_ms(u32 nTime);
void led_ctrl(u8 status);
u8 key_scan(void);
void speed_over(void);
void deal_key(void);
u8 read_data(u8 addr);
void write_data(u8 addr,u8 data);

#endif